package es.onlysolutions.gs.web.controller;

import es.onlysolutions.arq.core.mvc.command.AbstractCommandBean;
import es.onlysolutions.gs.web.commandBean.SearchBean;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.validation.BindException;

/**
 * Controller for the Google Searcher.
 * This controller handles all the petitions for the main page of the searcher.
 */
public class SearchController extends GSController
{

    protected AbstractCommandBean loadPage(HttpServletRequest httpServletRequest) throws Exception
    {
        return new SearchBean();
    }

    protected ModelAndView onSubmit(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object command, BindException e) throws Exception
    {
        SearchBean bean = (SearchBean) command;

        return new ModelAndView( getSuccessView(), getCommandName(), bean );
    }
}
